package top.lshaci.learning.alibaba.cloud.seata.storage.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.lshaci.learning.alibaba.cloud.seata.storage.entity.Storage;
import top.lshaci.learning.alibaba.cloud.seata.storage.mapper.StorageMapper;
import top.lshaci.learning.alibaba.cloud.seata.storage.service.StorageService;

/**
 * StorageServiceImpl
 *
 * @author lshaci
 * @since 1.0.0
 */
@Service
public class StorageServiceImpl extends ServiceImpl<StorageMapper, Storage> implements StorageService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deduct(String commodityCode, int count) {
        if (count == 5) {
            int i = 1 / 0;
        }
        baseMapper.deduct(commodityCode, count);
    }
}
